/***************************************************************************
 *   Copyright (C) 2008 by JBox systems
 *   gabi@shaargiora.co.il
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 ***************************************************************************/

#include "tweakaction.h"

#include <boost/filesystem.hpp>
#include <QString>

#include <jb/std/log.h>

namespace fs = boost::filesystem;

TweakAction::TweakAction(std::string path, std::string description):
	m_description(description),
	m_path(path) {
}

TweakAction::TweakActionType TweakAction::type() const {
	fs::path pathfd(path());
	std::string extension = QString(pathfd.extension().c_str()).toLower().toStdString();

	LOG("Tweak extension " << extension)

	if (extension == ".reg") {
		return REGISTRY;
	} else if (extension == ".vbs") {
		return VBSCRIPT;
	} else if (extension == ".exe") {
		return EXECUTABLE;
	} else {
		return UNKNOWN;
	}
}
